package com.sxj.springsourcecode.springframework.io.support;

import com.sxj.springsourcecode.springframework.io.config.Resource;
import com.sxj.springsourcecode.springframework.io.config.ResourceLoader;

/**
 * @ProjectName: spring-source-code
 * @Package: com.sxj.springsourcecode.springframework.io.support
 * @ClassName: DefaultResourceLoader
 * @Author: sxj
 * @Description:
 * @Date: 2024/2/21 22:39
 * @Version: 1.0.0
 */
public class DefaultResourceLoader implements ResourceLoader {
    @Override
    public Resource getResource(String location) {
        if (location.startsWith(CLASSPATH_PREFIX)){
            String path = location.replace(CLASSPATH_PREFIX, "");
            return new ClassPathResource(path);
        }
        return null;
    }
}
